<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="../taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>天天生鲜-商品列表</title>
	<link rel="stylesheet" type="text/css" href="${path}/static/front/css/reset.css">
	<link rel="stylesheet" type="text/css" href="${path}/static/front/css/main.css">
</head>
<body>
	<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到天天生鲜!</div>
			<div class="fr">
			
			<!-- 已登录 session作用域 user不为空 -->
 				<c:if test="${not empty user}">
					<div class="login_btn fl" >
						欢迎您：<em>${user.username}</em>
					</div>
					
					<div class="user_link fl">
						<span>|</span>
						<a href="user_center_info.html">用户中心</a>
						<span>|</span>
						<a href="${path}/cart/getCartListJsp.shtml?userId=${user.id}">我的购物车</a>
						<span>|</span>
						<a href="user_center_order.html">我的订单</a>
						<span>|</span>
						<a onclick="loginout()" href="#">退出登录</a>
					</div>
				</c:if>
				
			<!-- 未登录 session作用域 use为空 -->
				<c:if test="${empty user}">
   					<div class="login_btn fl">
						<a href="#" onclick="login()">登录</a>
						<span>|</span>
						<a href="register.html">注册</a>
					</div>  
				</c:if>
			</div>
		</div>		
	</div>

	<div class="search_bar clearfix">
		<a href="${path}/index.shtml" class="logo fl"><img src="${path}/static/front/images/logo.png"></a>
		<div class="search_con fl">
			<input type="text" class="input_text fl" name="" placeholder="搜索商品">
			<input type="button" class="input_btn fr" name="" value="搜索">
		</div>
		<div class="guest_cart fr">
			<a href="#" class="cart_name fl">我的购物车</a>
			<div class="goods_count fl">1</div>
		</div>
	</div>

	<div class="navbar_con">
		<div class="navbar clearfix">
			<div class="subnav_con fl">
				<h1>全部商品分类</h1>	
				<span></span>			
				<ul class="subnav">
					<li><a href="#" class="fruit">新鲜水果</a></li>
					<li><a href="#" class="seafood">海鲜水产</a></li>
					<li><a href="#" class="meet">猪牛羊肉</a></li>
					<li><a href="#" class="egg">禽类蛋品</a></li>
					<li><a href="#" class="vegetables">新鲜蔬菜</a></li>
					<li><a href="#" class="ice">速冻食品</a></li>
				</ul>
			</div>
			<ul class="navlist fl">
				<li><a href="">首页</a></li>
				<li class="interval">|</li>
				<li><a href="">手机生鲜</a></li>
				<li class="interval">|</li>
				<li><a href="">抽奖</a></li>
			</ul>
		</div>
	</div>

	<div class="breadcrumb">
		<a href="#">全部分类</a>
		<span>></span>
		<a href="#">新鲜水果</a>
	</div>

<!-- 新品推荐 -->
	<div class="main_wrap clearfix">
		<div class="l_wrap fl clearfix">
			<div class="new_goods">
				<h3>新品推荐</h3>
				<ul>
					<li>
						<a href="#"><img src="${path}/static/front/images/goods/goods001.jpg"></a>
						<h4><a href="#">进口柠檬</a></h4>
						<div class="prize">￥3.90</div>
					</li>
					<li>
						<a href="#"><img src="${path}/static/front/images/goods/goods002.jpg"></a>
						<h4><a href="#">玫瑰香葡萄</a></h4>
						<div class="prize">￥16.80</div>
					</li>
				</ul>
			</div>
		</div>



<!-- 商品列表 -->
		<div class="r_wrap fr clearfix">
			<div class="sort_bar">
				<a href="#" class="active">默认</a>
				<a href="#">价格</a>
				<a href="#">人气</a>
			</div>

			<ul class="goods_type_list clearfix">
			<!-- 1.拿到 商品集合 -->
				<c:forEach items="${secondProductList}" var="product">
				<li>
					<a href="${path}/product/getProductDetailJsp.shtml?productId=${product.id}"><img src="${product.mainImageFullUrl}<%-- /pic/${product.mainImage} --%>" ></a>
					<!-- "${path}/static/front/images/goods/goods006.jpg" -->
					<h4><a href="${path}/product/getProductDetailJsp.shtml?productId=${product.id}">${product.name}</a></h4>
					<div class="operate">
						<span class="prize">${product.price}</span>
						<span class="unit">库存/${product.stock}</span>
			<!-- 2.点击 进入 商品详情页面  -->
						<a href="${path}/product/getProductDetailJsp.shtml?productId=${product.id}" class="add_goods" title="加入购物车"></a>
						<!-- <a href="${path}/product/getProductList.shtml?secondCategoryId=${secondCategory.id}">-->
					</div>
				</li>
				
				</c:forEach>

			</ul>

			<div class="pagenation">
				<a href="#">上一页</a>
				<a href="#" class="active">1</a>
				<a href="#">2</a>
				<a href="#">3</a>
				<a href="#">4</a>
				<a href="#">5</a>
				<a href="#">下一页></a>
			</div>
		</div>
	</div>

	<div class="footer">
		<div class="foot_link">
			<a href="#">关于我们</a>
			<span>|</span>
			<a href="#">联系我们</a>
			<span>|</span>
			<a href="#">招聘人才</a>
			<span>|</span>
			<a href="#">友情链接</a>		
		</div>
		<p>CopyRight © 2016 北京天天生鲜信息技术有限公司 All Rights Reserved</p>
		<p>电话：010-****888    京ICP备*******8号</p>
	</div>
	
	<script src="${path}/static/common/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
    <script src="${path}/static/common/layer/layer.js" type="text/javascript" charset="utf-8"></script>
    <script src="${path}/static/common/mylayer.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">	
	
	/* 点击  右上方 的 登录 */
	function login() {
		layer.open({
			type : 2,
			tile : "添加",
			area : ["500px", "450px"],
			content : "${path}/user/getLoginJsp.shtml"
		});
	}

	/* 退出登录 */
		function loginout() {
			layer.confirm("确定退出？", function() {
				$.post(
					"${path}/user/loginout.shtml",		
					
					function(result) {
						if (result.success) { 
							// 如果 删除成功
								//1.mylayer弹窗 提示删除成功
								//2.jQuery .remove()： 移除 (购物车jsp页面里)  那一条记录
							mylayer.successUrl(result.msg,"http://localhost:8080/_0318_mall/index.shtml");
							
						} else {
							mylayer.errorMsg(result.msg);
						}//else
					},//function(result)
					"json"
				);//post
			});//layer.confirm
		}//loginout()
	
	</script>
</body>
</html>